﻿// Decompiled with JetBrains decompiler
// Type: System.Web.Razor.Tokenizer.Symbols.VBSymbol
// Assembly: System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// MVID: 682513D6-F37E-48AC-9909-F3EE103CFF14
// Assembly location: D:\Project\Idea\无人机外网\uav\客户端工程\排查工具\bin\Release\System.Web.Razor.dll

using System.Collections.Generic;
using System.Linq;
using System.Web.Razor.Parser.SyntaxTree;
using System.Web.Razor.Resources;
using System.Web.Razor.Text;

namespace System.Web.Razor.Tokenizer.Symbols
{
  /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Represents the VB symbol components.</summary>
  public class VBSymbol : SymbolBase<VBSymbolType>
  {
    private static Dictionary<VBSymbolType, string> _symbolSamples = new Dictionary<VBSymbolType, string>()
    {
      {
        VBSymbolType.LineContinuation,
        "_"
      },
      {
        VBSymbolType.LeftParenthesis,
        "("
      },
      {
        VBSymbolType.RightParenthesis,
        ")"
      },
      {
        VBSymbolType.LeftBracket,
        "["
      },
      {
        VBSymbolType.RightBracket,
        "]"
      },
      {
        VBSymbolType.LeftBrace,
        "{"
      },
      {
        VBSymbolType.RightBrace,
        "}"
      },
      {
        VBSymbolType.Bang,
        "!"
      },
      {
        VBSymbolType.Hash,
        "#"
      },
      {
        VBSymbolType.Comma,
        ","
      },
      {
        VBSymbolType.Dot,
        "."
      },
      {
        VBSymbolType.Colon,
        ":"
      },
      {
        VBSymbolType.QuestionMark,
        "?"
      },
      {
        VBSymbolType.Concatenation,
        "&"
      },
      {
        VBSymbolType.Multiply,
        "*"
      },
      {
        VBSymbolType.Add,
        "+"
      },
      {
        VBSymbolType.Subtract,
        "-"
      },
      {
        VBSymbolType.Divide,
        "/"
      },
      {
        VBSymbolType.IntegerDivide,
        "\\"
      },
      {
        VBSymbolType.Exponentiation,
        "^"
      },
      {
        VBSymbolType.Equal,
        "="
      },
      {
        VBSymbolType.LessThan,
        "<"
      },
      {
        VBSymbolType.GreaterThan,
        ">"
      },
      {
        VBSymbolType.Dollar,
        "$"
      },
      {
        VBSymbolType.Transition,
        "@"
      },
      {
        VBSymbolType.RazorCommentTransition,
        "@"
      },
      {
        VBSymbolType.RazorCommentStar,
        "*"
      }
    };

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Initializes a new instance of the <see cref="T:System.Web.Razor.Tokenizer.Symbols.VBSymbol" /> class.</summary>
    /// <param name="offset">The offset value.</param>
    /// <param name="line">The line value.</param>
    /// <param name="column">The column value.</param>
    /// <param name="content">The content String value.</param>
    /// <param name="type">The <see cref="T:System.Web.Razor.Tokenizer.Symbols.VBSymbolType" />.</param>
    public VBSymbol(int offset, int line, int column, string content, VBSymbolType type)
      : this(new SourceLocation(offset, line, column), content, type, Enumerable.Empty<RazorError>())
    {
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Initializes a new instance of the <see cref="T:System.Web.Razor.Tokenizer.Symbols.VBSymbol" /> class.</summary>
    /// <param name="start">The start of the source location.</param>
    /// <param name="content">The content String value.</param>
    /// <param name="type">The <see cref="T:System.Web.Razor.Tokenizer.Symbols.VBSymbolType" />.</param>
    public VBSymbol(SourceLocation start, string content, VBSymbolType type)
      : this(start, content, type, Enumerable.Empty<RazorError>())
    {
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Initializes a new instance of the <see cref="T:System.Web.Razor.Tokenizer.Symbols.VBSymbol" /> class.</summary>
    /// <param name="offset">The offset value.</param>
    /// <param name="line">The line value.</param>
    /// <param name="column">The column value.</param>
    /// <param name="content">The content String value.</param>
    /// <param name="type">The <see cref="T:System.Web.Razor.Tokenizer.Symbols.VBSymbolType" />.</param>
    /// <param name="errors">List of razor errors.</param>
    public VBSymbol(
      int offset,
      int line,
      int column,
      string content,
      VBSymbolType type,
      IEnumerable<RazorError> errors)
      : base(new SourceLocation(offset, line, column), content, type, errors)
    {
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Initializes a new instance of the <see cref="T:System.Web.Razor.Tokenizer.Symbols.VBSymbol" /> class.</summary>
    /// <param name="start">The start of the source location.</param>
    /// <param name="content">The content String value.</param>
    /// <param name="type">The <see cref="T:System.Web.Razor.Tokenizer.Symbols.VBSymbolType" />.</param>
    /// <param name="errors">List of razor errors.</param>
    public VBSymbol(
      SourceLocation start,
      string content,
      VBSymbolType type,
      IEnumerable<RazorError> errors)
      : base(start, content, type, errors)
    {
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets or sets the keyword used in the VB.</summary>
    /// <returns>The keyword used.</returns>
    public VBKeyword? Keyword { get; set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Indicates a value whether the current object is equal to the new object.</summary>
    /// <returns>true if the current object is equal to the new object; otherwise, false.</returns>
    /// <param name="obj">The object to compare.</param>
    public override bool Equals(object obj)
    {
      VBSymbol vbSymbol = obj as VBSymbol;
      if (!base.Equals(obj))
        return false;
      VBKeyword? keyword1 = vbSymbol.Keyword;
      VBKeyword? keyword2 = this.Keyword;
      return keyword1.GetValueOrDefault() == keyword2.GetValueOrDefault() & keyword1.HasValue == keyword2.HasValue;
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Returns the hash code for this instance.</summary>
    /// <returns>The hash code to return.</returns>
    public override int GetHashCode() => base.GetHashCode() ^ this.Keyword.GetHashCode();

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the specified data sample from the object.</summary>
    /// <returns>The specified data sample from the object.</returns>
    /// <param name="type">The <see cref="T:System.Web.Razor.Tokenizer.Symbols.VBSymbolType" />.</param>
    public static string GetSample(VBSymbolType type)
    {
      string str;
      if (VBSymbol._symbolSamples.TryGetValue(type, out str))
        return str;
      switch (type)
      {
        case VBSymbolType.WhiteSpace:
          return RazorResources.VBSymbol_WhiteSpace;
        case VBSymbolType.NewLine:
          return RazorResources.VBSymbol_NewLine;
        case VBSymbolType.Comment:
          return RazorResources.VBSymbol_Comment;
        case VBSymbolType.Identifier:
          return RazorResources.VBSymbol_Identifier;
        case VBSymbolType.Keyword:
          return RazorResources.VBSymbol_Keyword;
        case VBSymbolType.IntegerLiteral:
          return RazorResources.VBSymbol_IntegerLiteral;
        case VBSymbolType.FloatingPointLiteral:
          return RazorResources.VBSymbol_FloatingPointLiteral;
        case VBSymbolType.StringLiteral:
          return RazorResources.VBSymbol_StringLiteral;
        case VBSymbolType.CharacterLiteral:
          return RazorResources.VBSymbol_CharacterLiteral;
        case VBSymbolType.DateLiteral:
          return RazorResources.VBSymbol_DateLiteral;
        case VBSymbolType.RazorComment:
          return RazorResources.VBSymbol_RazorComment;
        default:
          return RazorResources.Symbol_Unknown;
      }
    }
  }
}
